package com.zzedu.result;

import java.util.Arrays;

public enum ResultEnum {
    SUCCESS("SUCCESS", "成功"),

    FAIL("FAIL", "失败"),


    LOGIN("LOGIN", "登录"),


    FORBIDDEN("FORBIDDEN", "无权限"),
    ;
    String code;

    String desc;

    ResultEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static ResultEnum getCode(String code) {

        return Arrays.stream(ResultEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
